import Vue from 'vue'
import Vuex from 'vuex'
import { setItem, getItem } from '@/api/storage'
Vue.use(Vuex)
const USER_TOKEN = 'USER_TOKEN'
export default new Vuex.Store({
  state: {
    user: getItem(USER_TOKEN),
    // 单条试题详情
    question: null
  },
  mutations: {
    // 存储token值
    setToken(state, value) {
      state.user = value
      setItem(USER_TOKEN, state.user)
    },
    // 单条试题详情
    questionDetail(state, value) {
      state.question = value
    }
  },
  actions: {},
  modules: {}
})
